
import 'package:flutter/material.dart';

class ZLButton extends StatelessWidget {
  const ZLButton(this.content, {
    Key? key,
    required this.callback,
    this.textStyle,
    this.bgColor = Colors.blue,
  }) : super(key: key);

  final VoidCallback callback;
  final String content;
  final TextStyle? textStyle;
  final dynamic? bgColor;

  @override
  Widget build(BuildContext context) {
    TextStyle? defaultTextStyle = Theme.of(context).textTheme.headline4;
    // TODO: implement build
    return ElevatedButton(
      onPressed: callback,
      child: Text(content, style: textStyle != null ? textStyle : defaultTextStyle),
      style: ButtonStyle(
        elevation: MaterialStateProperty.all(0),
        enableFeedback: false,
        splashFactory: NoSplash.splashFactory,
        // 将按钮背景设置为透明
        backgroundColor: MaterialStateProperty.all(bgColor),
      ),
    );
  }
}